;Make a DM, with 5x5 actuators. Numbering starts from top left.

function make_dm5, posns, psize,lenslet_pitch, m_pix

t = psize/2 + lenslet_pitch/m_pix*(indgen(5)-2)
x = reform(rebin(t,5,5),25,1)
y = rebin(t,25, /samp)
triangulate, x, y, triangles
dm = trigrid(x,y, posns, triangles, [1,1], [0,0,psize-1,psize-1])
end
